#ifndef ANLS_CORE_H
#define ANLS_CORE_H

#include <QFile>
#include <QTimer>
#include <QDebug>
#include <QObject>
#include <QProcess>
#include <QStatusBar>
#include <QTextCodec>
#include <QProgressBar>

#include <vtkSmartPointer.h>
#include <vtkImageData.h>
#include <vtkImageResample.h>
#include <vtkImageResize.h>
#include <vtkImageInterpolator.h>

#include "img_file.h"
#include "sys_data.h"

struct anls_Data {
    double volume[6] {0.0};
    double lesionVolume[6] {0.0};
    double lesionDensity[6] {0.0};
    vtkSmartPointer<vtkImageData> data{nullptr};
};

class anls_Core : public QObject
{
    Q_OBJECT

private:
    anls_Data m_data;
    const img_Info * m_info{nullptr};
    QProcess m_process;
    QTimer m_timer;
    QStatusBar * m_message;
    QProgressBar * m_progress;
    bool isCondaEnvirOK{false};
    bool isAnalysisPathOk{false};
    void readInfection();

private slots:
    void on_readoutput();
    void on_readerror();
    void on_getAnalysisData();

public:
    explicit anls_Core(QStatusBar * analysisMessage,
                       QProgressBar * progress,
                       QObject *parent = nullptr);

    ~anls_Core();

    void analysisImg(const img_Info* info);


signals:
    void analysisFinish();

    void getDataFinish(anls_Data& _data);
};

#endif // ANLS_CORE_H
